.map-container {
  p {
    margin: 0; // remove markdown block margin
  }
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    Helvetica Neue,
    PingFang SC,
    Microsoft YaHei,
    Source Han Sans SC,
    Noto Sans CJK SC,
    WenQuanYi Micro Hei,
    sans-serif;
  user-select: none;
  height: 100%;
  width: 100%;
  overflow: hidden; // prevent browser scroll container while dragging
  font-size: 15px;
  outline: none; // prevent browser default focus outline
  touch-action: none; // use pointer events instead of touch events
  * {
    box-sizing: border-box; // must have, to make getComputedStyle work right
  }
  &::-webkit-scrollbar {
    width: 0px;
    height: 0px;
  }
  .selected {
    outline: 2px solid var(--selected);
    outline-offset: 1px;
  }
  &.space-pressed {
    cursor: grab !important;
    * {
      cursor: grab !important;
    }
  }
  &.space-pressed:active {
    cursor: grabbing !important;
    * {
      cursor: grabbing !important;
    }
  }
  .hyper-link {
    text-decoration: none;
    margin-left: 0.3em;
  }
  me-main > me-wrapper > me-parent > me-epd {
    top: 50%;
    transform: translateY(-50%);
  }
  me-epd {
    top: 100%;
    transform: translateY(-50%);
  }
  .lhs {
    direction: rtl;
    & > me-wrapper > me-parent > me-epd {
      left: -10px;
    }
    me-epd {
      left: 5px;
    }
    me-tpc {
      direction: ltr;
    }
  }
  .rhs {
    & > me-wrapper > me-parent > me-epd {
      right: -10px;
    }
    me-epd {
      right: 5px;
    }
  }
  background-color: var(--bgcolor);
  .map-canvas {
    position: relative;
    user-select: none;
    width: fit-content; // 100% width if not set
    transform: scale(1);
    me-nodes {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      height: max-content;
      width: max-content;
      padding: var(--map-padding);
    }
  }
  me-main {
    // primary node / main node
    & > me-wrapper {
      position: relative; // make subline svg's offsetParent be the main node
      margin: var(--main-gap-y) var(--main-gap-x);
      & > me-parent {
        margin: 10px;
        padding: 0;
        & > me-tpc {
          border-radius: var(--main-radius);
          background-color: var(--main-bgcolor);
          border: 2px solid var(--main-color);
          color: var(--main-color);
          padding: 8px 25px;
        }
      }
    }
  }
  me-wrapper {
    display: block;
    pointer-events: none;
    width: fit-content;
    // position: relative;
  }
  me-children,
  me-parent {
    display: inline-block;
    vertical-align: middle;
  }
  me-root {
    position: relative;
    margin: 45px 0;
    z-index: 10;
    me-tpc {
      font-size: 25px;
      color: var(--root-color);
      padding: 10px 30px;
      border-radius: var(--root-radius);
      border: var(--root-border-color) 2px solid;
      background-color: var(--root-bgcolor);
    }
  }
  me-parent {
    position: relative; // for locating expand button
    cursor: pointer;
    padding: 6px var(--node-gap-x);
    margin-top: var(--node-gap-y);
    z-index: 10;
    me-tpc {
      position: relative;
      border-radius: 3px;
      color: var(--color);
      padding: var(--topic-padding);

      // drag preview
      .insert-preview {
        position: absolute;
        width: 100%;
        left: 0px;
        z-index: 9;
      }
      .show {
        background: #7ad5ff;
        pointer-events: none;
        opacity: 0.7;
        border-radius: 3px;
      }
      .before {
        height: 14px;
        top: -14px;
      }
      .in {
        height: 100%;
        top: 0px;
      }
      .after {
        height: 14px;
        bottom: -14px;
      }
    }
    me-epd {
      position: absolute;
      height: 18px;
      width: 18px;
      opacity: 0.8;
      background-image: url('./icons/add-circle.svg');
      background-repeat: no-repeat;
      background-size: contain;
      background-position: center;

      pointer-events: all;
      z-index: 9;
      &.minus {
        background-image: url('./icons/minus-circle.svg') !important;
        transition: opacity 0.3s;
        opacity: 0;
        @media (hover: hover) {
          &:hover {
            opacity: 0.8;
          }
        }
        @media (hover: none) {
          & {
            opacity: 0.8;
          }
        }
      }
    }
  }

  // iconfont
  .icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }
  .lines,
  .summary,
  .subLines,
  .topiclinks,
  .linkcontroller {
    position: absolute;
    height: 102%;
    width: 100%;
    top: 0;
    left: 0;
  }
  .topiclinks,
  .linkcontroller,
  .summary {
    pointer-events: none;
    z-index: 20;
  }

  .summary > g,
  .topiclinks > g {
    cursor: pointer;
    pointer-events: stroke;
    z-index: 20;
  }
  .label-container {
    z-index: 21;
  }

  .lines,
  .subLines {
    pointer-events: none;
  }

  #input-box {
    position: absolute;
    top: 0;
    left: 0;
    width: max-content; // let words expand the div and keep max length at the same time
    max-width: 35em;
    direction: ltr;
    user-select: auto;
    pointer-events: auto;
    color: var(--color);
    background-color: var(--bgcolor);
    outline: 1px solid #ccc;
    border-radius: 2px;
    z-index: 100;
  }

  me-tpc {
    display: block;
    max-width: 35em;
    white-space: pre-wrap;
    pointer-events: all;
    & > * {
      // tags,icons,images should not response to click event
      pointer-events: none;
    }
    & > a,
    & > iframe {
      pointer-events: auto;
    }
    & > .text {
      display: inline-block;
      // Allow links inside markdown text to be clickable
      a {
        pointer-events: auto;
      }
    }
    & > img {
      display: block;
      margin-bottom: 8px;
      object-fit: cover;
    }
  }
  .circle {
    position: absolute;
    height: 10px;
    width: 10px;
    margin-top: -5px;
    margin-left: -5px;
    border-radius: 100%;
    background: #757575;
    border: 2px solid #ffffff;
    z-index: 50;

    cursor: pointer;
  }

  .tags {
    direction: ltr;
    span {
      display: inline-block;
      border-radius: 3px;
      padding: 2px 4px;
      background: #d6f0f8;
      color: #276f86;
      margin: 0px;
      font-size: 12px;
      line-height: 1.3em;
      margin-right: 4px;
      margin-top: 2px;
    }
  }
  .icons {
    display: inline-block;
    direction: ltr;
    margin-left: 5px;
    span {
      display: inline-block;
      line-height: 1.3em;
    }
  }

  .mind-elixir-ghost {
    position: fixed;
    top: -100%;
    left: -100%;
    box-sizing: content-box;
    opacity: 0.5;
    background-color: var(--main-bgcolor);
    border: 2px solid var(--main-color);
    color: var(--main-color);
    max-width: 200px;
    width: fit-content;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 8px 16px;
    border-radius: 6px;
  }

  .selection-area {
    background: #4f90f22d;
    border: 1px solid #4f90f2;
  }

  .svg-label {
    position: absolute;
    left: 0; // keep width
    top: 0;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
    padding: 2px;
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
    max-width: 200px;
    border-radius: 3px;
    padding: var(--topic-padding);
  }
}
